package rpd.mapper;

import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import rpd.model.TbWorkExperience;
import rpd.model.TbWorkExperienceExample;
import rpd.model.TbWorkExperienceKey;

public interface TbWorkExperienceMapper {
    long countByExample(TbWorkExperienceExample example);

    int deleteByExample(TbWorkExperienceExample example);

    @Delete({
        "delete from tb_work_experience",
        "where id = #{id,jdbcType=CHAR}"
    })
    int deleteByPrimaryKey(TbWorkExperienceKey key);

    @Insert({
        "insert into tb_work_experience (id, resume_id, ",
        "company, duty, address, ",
        "start_time, end_time, salary, ",
        "salary_type)",
        "values (#{id,jdbcType=CHAR}, #{resumeId,jdbcType=CHAR}, ",
        "#{company,jdbcType=CHAR}, #{duty,jdbcType=CHAR}, #{address,jdbcType=CHAR}, ",
        "#{startTime,jdbcType=DATE}, #{endTime,jdbcType=DATE}, #{salary,jdbcType=INTEGER}, ",
        "#{salaryType,jdbcType=INTEGER})"
    })
    int insert(TbWorkExperience record);

    int insertSelective(TbWorkExperience record);

    List<TbWorkExperience> selectByExample(TbWorkExperienceExample example);

    @Select({
        "select",
        "id, resume_id, company, duty, address, start_time, end_time, salary, salary_type",
        "from tb_work_experience",
        "where id = #{id,jdbcType=CHAR}"
    })
    @ResultMap("rpd.mapper.TbWorkExperienceMapper.BaseResultMap")
    TbWorkExperience selectByPrimaryKey(TbWorkExperienceKey key);

    int updateByExampleSelective(@Param("record") TbWorkExperience record, @Param("example") TbWorkExperienceExample example);

    int updateByExample(@Param("record") TbWorkExperience record, @Param("example") TbWorkExperienceExample example);

    int updateByPrimaryKeySelective(TbWorkExperience record);

    @Update({
        "update tb_work_experience",
        "set resume_id = #{resumeId,jdbcType=CHAR},",
          "company = #{company,jdbcType=CHAR},",
          "duty = #{duty,jdbcType=CHAR},",
          "address = #{address,jdbcType=CHAR},",
          "start_time = #{startTime,jdbcType=DATE},",
          "end_time = #{endTime,jdbcType=DATE},",
          "salary = #{salary,jdbcType=INTEGER},",
          "salary_type = #{salaryType,jdbcType=INTEGER}",
        "where id = #{id,jdbcType=CHAR}"
    })
    int updateByPrimaryKey(TbWorkExperience record);
}